#include <stdio.h>
#include <string.h>
#define MAX_SIZE 100
#define ERR_UNDERFLOW -1
typedef struct{
    int top;
    char data[MAX_SIZE];
}stack;
int StackInit(stack *stk){
    stk->top = 0;
    return 0;
}
int StackPush(stack *stk, int toPush){
    stk->data[stk->top] = toPush;
    stk->top++;
    return 0;
}
int StackPop(stack *stk, char *toPop){
    // 返回栈下溢错误码
    if (stk->top == 0) {
        return ERR_UNDERFLOW;
    }
    *toPop = stk->data[stk->top - 1];
    stk->top--;
    return 0;
}
int StackEmpty(stack *stk){
    if(stk->top == 0){
        return 1;
    }else{
        return 0;
    }
}
int GetTop(stack *stk){
    // 返回栈下溢错误码
    if (stk->top == 0) {
        return ERR_UNDERFLOW;
    }
    return stk->data[stk->top - 1];
}
int ToPostfixExp(char str[], stack *infix, stack *postfix){
    int i, strLen = strlen(str);
    char latest, infixTop;
    for(i=0;i<strLen;i++){
        if(str[i] >= '0' && str[i] <= '9'){
            StackPush(postfix, str[i]);
        }
        else if(str[i] == '('){
            StackPush(infix, '(');
        }
        else if(str[i] == ')'){
            infixTop = GetTop(infix);
            while(infixTop != '('){
                StackPush(postfix, infixTop);
                StackPop(infix, &latest);
                infixTop = GetTop(infix);
            }
            StackPop(infix, &latest);
        }
            //  +* +    * +     +*( +   +*(+* +
        else if(str[i] == '+' || str[i] == '-'){
            while(!StackEmpty(infix) && GetTop(infix) != '('){
                StackPush(postfix, GetTop(infix));
                StackPop(infix, &latest);
            }
            if(StackEmpty(infix) || GetTop(infix) == '('){
                StackPush(infix, str[i]);
            }
        }
            //  +* *    * *     +*(+* *      +*(* *      +*( *
        else if(str[i] == '*' || str[i] == '/'){
            infixTop = GetTop(infix);
            if(StackEmpty(infix) || infixTop == '(' || infixTop == '+' || infixTop == '-'){
                StackPush(infix, str[i]);
            }else if(infixTop == '*' || infixTop == '/'){
                StackPush(postfix, GetTop(infix));
                StackPop(infix, &latest);
                StackPush(infix, str[i]);
            }
        }
    }
    while(!StackEmpty(infix)){
        StackPush(postfix, GetTop(infix));
        StackPop(infix, &latest);
    }
    return 0;
}
int CalPostfix(stack *postfix, stack *result){
    int i, operandL, operandR;
    char temp, latest;
    for(i=0;i<postfix->top-1;i++){
        temp = postfix->data[i];
        if(temp >= '0' && temp <= '9'){
            StackPush(result, temp);
        }else{
            operandR = (int)StackPop(result, &latest);
            operandL = (int)StackPop(result, &latest);
        }
    }
    return 0;
}
int main(void){
    stack infix, postfix;
    char exp[MAX_SIZE];
    StackInit(&infix);
    StackInit(&postfix);
    scanf("%s", exp);
    ToPostfixExp(exp, &infix, &postfix);
    CalPostfix(&postfix, &infix);
    return 0;
}
